import {
  SystemSnQuery,
  SystemFileCorrelationId,
  SystemFileUploadDel,
  SystemEventApi,
  SystemZeroCodeDataFindFormSource,
  SystemWorkSheet,
  SystemWorkSheetFindById,
  SystemZeroCodeDataImportGet,
  SystemWorkSheetCheckOnly,
  SystemUserMenuZeroCode,
  SystemZeroCodeDataLogRelationId,
  SystemSerialNoCreate,
  SystemDictionaryFindByParentIds,
  SystemDictionaryFindByParentId,
  SystemZeroCodeFindById,
  SystemWorkSheetCorrelationRows,
  SystemWorkSheetCorrelationDefault,
  SystemWorkSheetCorrelationDefaultAdd,
  SystemWorkSheetCorrelationFilter,
  SystemWorkSheetCorrelationFilterAll,
  SystemZeroCodeGridCustomFindByKey,
  SystemZeroCodeGridCustomSave,
  SystemZeroCodeAutomationFindById,
} from "@/services/api";
import { request, requestSync, METHOD } from "@/utils/request";
/**
 * 根据Id获取
 */
export async function findById(id) {
  return request(SystemZeroCodeFindById + "/" + id, METHOD.GET, {});
}
/**
 *
 */
export function importDataGet(param) {
  return request(SystemZeroCodeDataImportGet, METHOD.POST, param, {
    timeout: 9999999999999,
    headers: {
      "Content-Type": "multipart/form-data;boundary=" + new Date().getTime(),
    },
  });
}
/**
 * 保存业务数据
 */
export function businessData(param) {
  return request(SystemWorkSheet, METHOD.POST, param, {
    timeout: 9999999999999,
  });
}
/**
 * 根据Id获取业务数据
 */
export function businessDataById(param) {
  return request(SystemWorkSheetFindById, METHOD.POST, param);
}

/**
 * 保存业务数据
 */
export async function businessDataFormSource(param) {
  return await requestSync(
    SystemZeroCodeDataFindFormSource,
    METHOD.POST,
    param
  );
}

/**
 * 调用api
 */
export function eventApi(param) {
  return requestSync(SystemEventApi, METHOD.POST, param, {
    timeout: 9999999999999,
  });
}

/**
 * 删除附件
 */
export function fileUploadDel(param) {
  return requestSync(SystemFileUploadDel, METHOD.POST, param);
}

/**
 * 获取附件
 */
export function fileCorrelationId(id) {
  return requestSync(SystemFileCorrelationId + "/" + id, METHOD.GET, {});
}
/**
 * 获取编码
 */
export function snQuery(param) {
  return requestSync(SystemSnQuery, METHOD.POST, param);
}

/**
 * 根据Id获取
 */
export async function menuZeroCode(param) {
  return request(SystemUserMenuZeroCode, METHOD.POST, param);
}

/**
 * 编号生成
 */
export function serialNoCreate(param) {
  return requestSync(SystemSerialNoCreate, METHOD.POST, param);
}
/**
 * 唯一检查
 */
export function only(param) {
  return requestSync(SystemWorkSheetCheckOnly, METHOD.POST, param);
}

/**
 * 获取敏捷开发日志
 */
export function agileDataLogRelationId(param) {
  return request(SystemZeroCodeDataLogRelationId, METHOD.POST, param);
}
/**
 * 根据父级Id获取字典树信息
 */
export function dictionaryQueryByIds(param) {
  return request(SystemDictionaryFindByParentIds, METHOD.POST, param);
}

/**
 * 根据父级Id获取字典信息
 */
export function dictionaryParentId(parentId) {
  return request(
    SystemDictionaryFindByParentId + "/" + parentId,
    METHOD.GET,
    {}
  );
}
/**
 * 查询业务数据
 */
export async function findCorrelationRows(param) {
  return request(SystemWorkSheetCorrelationRows, METHOD.POST, param);
}
/**
 * 查询业务数据
 */
export async function findCorrelationFilter(param) {
  return request(SystemWorkSheetCorrelationFilter, METHOD.POST, param);
}
/**
 * 查询业务数据
 */
export async function findCorrelationFilterAll(param) {
  return request(SystemWorkSheetCorrelationFilterAll, METHOD.POST, param);
}
/**
 * 查询业务数据
 */
export async function findCorrelationDefault(param) {
  return request(SystemWorkSheetCorrelationDefault, METHOD.POST, param);
}
/**
 * 查询业务数据
 */
export async function findCorrelationDefaultAdd(param) {
  return request(SystemWorkSheetCorrelationDefaultAdd, METHOD.POST, param);
}
/**
 *
 */
export async function gridCustomFindByKey(id) {
  return request(SystemZeroCodeGridCustomFindByKey + "/" + id, METHOD.GET, {});
}

/**
 */
export async function gridCustomSave(param) {
  return request(SystemZeroCodeGridCustomSave, METHOD.POST, param);
}

/**
 * 根据Id获取
 */
export async function findAutomationById(id) {
  return request(SystemZeroCodeAutomationFindById + "/" + id, METHOD.GET, {});
}
export default {
  findById,
  eventApi,
  businessData,
  businessDataById,
  businessDataFormSource,
  fileUploadDel,
  fileCorrelationId,
  snQuery,
  importDataGet,
  menuZeroCode,
  serialNoCreate,
  agileDataLogRelationId,
  dictionaryQueryByIds,
  dictionaryParentId,
  only,
  findCorrelationRows,
  findCorrelationFilter,
  findCorrelationFilterAll,
  findCorrelationDefault,
  findCorrelationDefaultAdd,
  gridCustomFindByKey,
  gridCustomSave,
  findAutomationById,
};
